﻿// See https://aka.ms/new-console-template for more information

using 监听读取日志文件变动;

Console.WriteLine("监听读取日志文件变动!");

// 日志文件路径
string logFilePath = @"D:\ACCT\log";

// 注意：这里的path是文件夹路径，不包含文件名
FileSystemWatcher watcher = new FileSystemWatcher(logFilePath);
watcher.EnableRaisingEvents = true;
watcher.IncludeSubdirectories = true;

// 文件变化时触发的事件
watcher.Changed += new FileSystemEventHandler(LogFile.watcher_Changed);

Console.WriteLine("监听文件变化...按任意键退出。");
Console.ReadLine();